<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:body>
        <ui:composition template="/WEB-INF/jsf2/templates/templateBasic.xhtml">
            <ui:define name="top">
                <ui:include src="/WEB-INF/jsf2/templates/templateNavigation.xhtml"/>
            </ui:define>
            <ui:define name="bottom">
                <ui:include src="/WEB-INF/jsf2/templates/templateBottom.xhtml"/>
            </ui:define>

            <ui:define name="content">
                <f:loadBundle basename="com.gq2.multilang.prePool" var="txt_pre"/>
                <f:loadBundle basename="com.gq2.multilang.score" var="txt_sco"/>
                <f:loadBundle basename="com.gq2.multilang.granq" var="txt_com"/>

		<h:form id="form1">
		    <h3>
			<h:outputLabel for="pagetitle" id="pagetitlelabel" styleClass="page-title">
			    <h:outputText id="pagetitle" value="#{txt_pre.prePoolPageTitle}"/>
			</h:outputLabel>
		    </h3>
		    <br/>
		    <br/>
		    <table>
			<tbody>
			    <tr>
				<td>
				    <ui:include  src="/WEB-INF/includes/tools/seasonAndDayInput.xhtml">
					<ui:param name="bean" value="#{prePool}"/>
					<ui:param name="requiredSeason" value="true"/>
					<ui:param name="requiredDayOrder" value="false"/>
					<ui:param name="mode" value="onlyADay"/>
				    </ui:include>
				</td>
				<td>
				    <h:outputLabel for="textradio" id="textradiolabel">
					<h:outputText id="textradio" value="#{txt_pre.sorting}"/>
				    </h:outputLabel>
				    <h:selectOneRadio id="radioButtonList1" layout="lineDirection" onchange="submit();" value="#{prePool.sortby}" valueChangeListener="#{prePool.changeValueSortby}">
					<f:selectItem itemLabel="#{txt_pre.byRating}" itemValue="rating"/>
					<f:selectItem itemLabel="#{txt_pre.byOrder}" itemValue="order"/>
				    </h:selectOneRadio>
				    <h:commandButton action="#{prePool.updateScores()}" id="buttonupdate" value="#{txt_pre.prePoolUpdateScores}"/>

				</td>
			    </tr>
			    <tr colspan="3">
				<h:messages/>
			    </tr>
			    <tr>
				<td colspan="3">
				    <br/>
				    <br/>
				    <c:if test="#{prePool.prePoolList.size() != 0}">
					<ui:include src="/WEB-INF/includes/dataTables/prePoolTable.xhtml">
					    <ui:param name="bean" value="#{prePool}"/>
					</ui:include>
				    </c:if>
				</td>
			    </tr>
			    <tr>
				<td colspan="2" valign="top">
				    <br/>
				    <br/>
				    <h3>
					<h:outputLabel for="textlabel1" id="label1">
					    <h:outputText id="textlabel1" value="#{txt_pre.prePoolInsertMatches}"/>
					</h:outputLabel>
				    </h3>
				    <br/>
				    <br/>
				    <h:commandButton action="#{prePool.insertTotal}" id="button3" value="#{txt_pre.prePoolInsertTotal}"/>
				    <br/>
				    <br/>
				    <h:outputLabel for="textchampionship" id="textchampionshiplabel">
					<h:outputText id="textchampionship" value="#{txt_com.Championship}"/>
				    </h:outputLabel>
				    <h:outputLabel for="componentLabel1Text" id="textroundlabel1">
					<h:outputText id="componentLabel1Text" value="#{txt_com.Round}"/>
				    </h:outputLabel>
				    <br/>
				    <h:selectOneMenu id="dropdown1" onchange="submit();" value="#{prePool.chaId}" valueChangeListener="#{prePool.changeValueChampionship}">
					<f:selectItems id="dropdown1SelectItems" value="#{prePool.championshipItemList}"/>
				    </h:selectOneMenu>
				    <h:selectOneMenu id="dropdown2" value="#{prePool.round}">
					<f:selectItems id="dropdown2SelectItems" value="#{prePool.roundItemList}"/>
				    </h:selectOneMenu>
				    <br/>
				    <br/>
				    <h:outputLabel for="textmatches1" id="textmatcheslabel1">
					<h:outputText id="textmatches1" value="#{txt_pre.prePoolMatches}"/>
				    </h:outputLabel>
				    <h:inputText id="matches1" maxlength="2" size="2" value="#{prePool.insertedmatches}"/>
				    <h:outputText id="textmatches2" value="#{txt_pre.prePoolAlternativeMatches}"/>
				    <h:selectBooleanCheckbox id="checkbox1" value="#{prePool.alternative}"/>
				    <br/>
				    <br/>
				    <h:commandButton action="cancel" id="button1" value="#{txt_com.Cancel}"/>
				    <h:commandButton action="#{prePool.showMatches}" id="button4" value="#{txt_pre.prePoolShowMatches}"/>
				    <h:commandButton action="#{prePool.insertMatches}" id="button2" value="#{txt_pre.prePoolInsert}"/>
				    <br/>
				</td>
				<td>
				    <br/>
				    <br/>
				    <table>
					<tr>
					    <td>
						<h:dataTable columnClasses=",,col-center" headerClass="list-header" id="dataTable2"
							     rowClasses="list-row-even,list-row-odd" value="#{prePool.dataMatches}" var="currentMatch">
						    <h:column id="column101">
							<f:facet name="header">
							    <h:outputText id="outputText102" value="#{txt_sco.homeTeam}"/>
							</f:facet>
							<h:outputText id="outputText101" value="#{currentMatch['preTeaName1']}"/>
						    </h:column>
						    <h:column id="column102">
							<f:facet name="header">
							    <h:outputText id="outputText104" value="#{txt_sco.outTeam}"/>
							</f:facet>
							<h:outputText id="outputText103" value="#{currentMatch['preTeaName2']}"/>
						    </h:column>
						    <h:column id="column103">
							<f:facet name="header">
							    <h:outputText id="outputText106" value="#{txt_com.Action}"/>
							</f:facet>
							<h:commandButton action="#{prePool.inputMatch}" id="button10" styleClass="button-short" value="#{txt_pre.prePoolInsert}">
							    <f:setPropertyActionListener target="#{prePool.dataMatch}" value="#{currentMatch}"/>
							</h:commandButton>
						    </h:column>
						</h:dataTable>
					    </td>
					</tr>
					<tr>
					    <td>
						<h:selectOneMenu id="dropdown11" value="#{prePool.team1}">
						    <f:selectItems id="dropdown11SelectItems" value="#{prePool.teamItemList}"/>
						</h:selectOneMenu>
						<h:selectOneMenu id="dropdown12" value="#{prePool.team2}">
						    <f:selectItems id="dropdown12SelectItems" value="#{prePool.teamItemList}"/>
						</h:selectOneMenu>
						<h:commandButton action="#{prePool.createMatch}" id="button11"
								 styleClass="button-short" value="#{txt_pre.prePoolInsert}"/>
					    </td>
					</tr>
				    </table>
				</td>
			    </tr>
			</tbody>
		    </table>
		</h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
